package com.studio49.exmple.core.entity.pub;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import com.github.pagehelper.Page;

/**
 * 分页插件实体类
 * @author chensj
 * @date 2019年4月27日  上午9:59:55
 * @version 1.0
 */
public class PageView implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	//当前页
	private int pageNow;
	//总页数
	private int pageCount;
	//总数量
	private long rowCount;
	//记录数据集
	@SuppressWarnings("rawtypes")
	private List records;
	
	
	@SuppressWarnings("rawtypes")
	public PageView(List list) {
		records = list;
		if (list instanceof Page) {
			Page page = (Page) list;
			this.pageNow = page.getPageNum();
			this.pageCount = page.getPages();
			this.rowCount = page.getTotal();
		} else if (list instanceof Collection) {
			this.pageNow = 1;
			this.pageCount = 1;
			this.rowCount = list.size();
		}
	}


	public int getPageNow() {
		return pageNow;
	}


	public void setPageNow(int pageNow) {
		this.pageNow = pageNow;
	}


	public int getPageCount() {
		return pageCount;
	}


	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}


	public long getRowCount() {
		return rowCount;
	}


	public void setRowCount(long rowCount) {
		this.rowCount = rowCount;
	}


	@SuppressWarnings("rawtypes")
	public List getRecords() {
		return records;
	}


	@SuppressWarnings("rawtypes")
	public void setRecords(List records) {
		this.records = records;
	}
	
}

